package org.idea.spring.bean.source.config;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

/**
 * @Author linhao
 * @Date created in 10:39 上午 2021/5/3
 */
//@Configuration(value = "myConfig")
@Scope(value = "singleton")
public class MyConfig implements InitializingBean, BeanPostProcessor {

    private String name;

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("myConfig init");
        this.name = "idea";
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        System.out.println("post");
        return bean;
    }

    public String getName() {
        return name;
    }
}
